package com.atguigu.guli.service.edu.mapper;

import com.atguigu.guli.service.base.dto.CourseDto;
import com.atguigu.guli.service.edu.entity.Course;
import com.atguigu.guli.service.edu.entity.form.CourseInfoForm;
import com.atguigu.guli.service.edu.entity.vo.CoursePublishVo;
import com.atguigu.guli.service.edu.entity.vo.CourseVo;
import com.atguigu.guli.service.edu.entity.vo.WebCourseVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 课程 Mapper 接口
 * </p>
 *
 * @author Helen
 * @since 2021-07-01
 */
@Repository
public interface CourseMapper extends BaseMapper<Course> {
    CourseInfoForm selectCourseInfoFormById(String id);

    List<CourseVo> selectPageByCourseQuery(
            Page<CourseVo> pageParam,
            @Param(Constants.WRAPPER) QueryWrapper<CourseVo> queryWrapper);

    CoursePublishVo selectCoursePublishVoById(String id);

    /**
     * 查询课程和讲师信息
     * @param courseId
     * @return
     */
    WebCourseVo selectWebCourseVoById(String courseId);

    /**
     * 更新浏览数量
     * @param id
     * @return
     */
    int updateViewCountById(String id);

    CourseDto selectCourseDtoById(String courseId);


    void updateByCountById(String id);
}
